package com.xwh.week4;

public class Practice4 {
    public static void main(String[] args) {
        int num=0;
        for(int i=3;i<100000;i++){
            if(method(i)){
                num+=i;
            }
        }
        System.out.println(num);
    }
    public static boolean method(int num){
        int temp=num;
        int ans=0;
        while(temp>0){
            int n=temp%10;
            ans+=method1(n);
            temp/=10;
        }
        return ans==num;
    }
    public static int method1(int n){
        int ans=1;
        for(int i=1;i<=n;i++){
            ans*=i;
        }
        return ans;
    }
}
